<!DOCTYPE html>
<html>
<head>
<script>
function loadXMLDoc(url){
	var xmlhttp;
	var txt,x,xx,i;
	if (window.XMLHttpRequest){
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			txt="<table border='1'><tr><th>Time</th><th>Currency</th><th>Rate</th></tr>";
			x=xmlhttp.responseXML.documentElement.getElementsByTagName("Cube");
			xdate = xmlhttp.responseXML.documentElement.getElementsByTagName("Cube")[0].attributes;
			
			for (i=0;i<x.length;i++){
				txt=txt + "<tr>";
				xx=x[i].getElementsByTagName("Cube");

				txt=txt + + "<td>" + xdate + "</td>";

				{
					try{
						txt=txt + "<td>" + xx[0].firstChild.nodeValue + "</td>";
						
					} catch (er) {
						txt=txt + "<td> </td>";
					}
		        }
				xx=x[i].getElementsByTagName("Cube")[0].attributes;
				{
					try{
						txt=txt + "<td>" + xx[0].firstChild.nodeValue + "</td>";
					} catch (er) {
						txt=txt + "<td> </td>";
					}
				}
				txt=txt + "</tr>";
			}
			txt=txt + "</table>";
			document.getElementById('txtCDInfo').innerHTML=txt;
		}
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send();
}
</script>
</head>
<body>
	<div id="txtCDInfo">
		<button onclick="loadXMLDoc('../xml/eurofxref-hist-90d.xml')">Get CD info</button>
	</div>
</body>
</html>
